$(function(){
    var map;
    var gdir;
    
    gdir = new GDirections(map);
    GEvent.addListener(gdir, "load", onGDirectionsLoad);
    
    setDirections("Stockholm", "Uppsala");

    function setDirections(fromAddress, toAddress, locale) {
      gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": locale });
    }
    
    function onGDirectionsLoad(){
	console.debug(gdir.getDistance().meters);
    }
});